namespace UniversalAdminSystem.Application.Common.Exceptions;

/// <summary>
/// 业务异常基类
/// </summary>
public class BusinessException : Exception
{
    public string ErrorCode { get; }

    public BusinessException(string message, string errorCode = "BUSINESS_ERROR") : base(message)
    {
        ErrorCode = errorCode;
    }

    public BusinessException(string message, Exception innerException, string errorCode = "BUSINESS_ERROR") : base(message, innerException)
    {
        ErrorCode = errorCode;
    }
}

/// <summary>
/// 菜单相关业务异常
/// </summary>
public class MenuBusinessException : BusinessException
{
    public MenuBusinessException(string message, string errorCode = "MENU_ERROR") : base(message, errorCode) { }
}

/// <summary>
/// 未找到异常
/// </summary>
public class NotFoundException : BusinessException
{
    public NotFoundException(string message) : base(message, "NOT_FOUND") { }
}

/// <summary>
/// 验证异常
/// </summary>
public class ValidationException : BusinessException
{
    public ValidationException(string message) : base(message, "VALIDATION_ERROR") { }
}